import request from "@/utils/request"
import { useCookieStore } from "@/stores/cookieStore"


// 获取搜索默认关键字
export const getDefaultSearchKeywordsApi = () => {
  return request({
    url: '/search/default'
  })
}

// 获取搜索联想
export const getSearchSuggestApi = (keywords) => {
  return request({
    url: '/search/suggest',
    params: {
      keywords
    }
  })
}

// 搜索
export const onSearchApi = (key, type, limit, offset) => {
  const useCookie = useCookieStore()
  return request({
    url: '/cloudsearch',
    params: {
      cookie: useCookie.cookie.cookie,
      keywords: key,
      type,
      limit,
      offset
    }
  })
}